/**
 * @category 判断两个日期有没有交集的方法
 * @param {start1} start1 first string in an isDateIntersection.
 * @param {string} end1 The second string in an isDateIntersection.
 * @param {string} start2 The three string in an isDateIntersection.
 * @param {string} end2 The four string in an isDateIntersection.
 * @example  isDateIntersection(YYYY-MM-DD, YYYY-MM-DD,YYYY-MM-DD,YYYY-MM-DD)=>boolean
 */
export default function isDateIntersection(start1: string, end1: string, start2: string, end2: string) {
    const start_date_1 = new Date(start1.replace('-', '/').replace('-', '/'))
    const end_date_1 = new Date(end1.replace('-', '/').replace('-', '/'))
    const start_date_2 = new Date(start2.replace('-', '/').replace('-', '/'))
    const end_date_2 = new Date(end2.replace('-', '/').replace('-', '/'))
    if (start_date_1 >= start_date_2 && start_date_1 <= end_date_2) {
        return true
    }
    if (end_date_1 >= start_date_2 && end_date_1 <= end_date_2) {
        return true
    }
    if (start_date_1 <= start_date_2 && end_date_1 >= end_date_2) {
        return true
    }
    return false
}
